#!/usr/bin/env bash

echo "start test.sh"
echo -e "\n"
echo `who`
echo -e "\n"
echo `w`
echo -e "\n"
echo `pwd`
echo -e "\n"

export ANDROID_HOME=../../Sdk
export ANDROID_NDK_HOME=../../ndk

./gradlew :mylibrary:build
erro=$?
echo "gradlew return $erro "
echo `pwd`
echo -e "\n"

apk="mylibrary/build/intermediates/bundles/default/classes.jar"

#tdirs="../test/app/libs/"
#target=$tdirs"Mysub.jar"
#erro=0

if [ -f "$apk" ];then
    echo -e "\n$apk ok"
    #mkdir -p tdirs
    #cp $apk $target
else
    echo -e "\n$apk filed"
    erro=-1
fi


echo "stop test.sh"
exit $erro